package com.google.code.SpolecnyCms.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class CmsAdmin implements EntryPoint {
  /**
   * The message displayed to the user when the server cannot be reached or
   * returns an error.
   */
  private static final String SERVER_ERROR = "An error occurred while "
      + "attempting to contact the server. Please check your network "
      + "connection and try again.";

  /**
   * Create a remote service proxy to talk to the server-side Greeting service.
   */
  private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);

  /** 
   * This is the entry point method.
   */
  public void onModuleLoad() {


		DockLayoutPanel p = new DockLayoutPanel(Unit.EM);
		LayoutPanel header = new LayoutPanel();
		
		
		/* -- header -- */
		
		HTML title = new HTML("<h1 class=\"adminTitle\">Spolecny CMS</h1>");
		header.add(title);
		header.setWidgetLeftRight(title, 0, Unit.EM, 13, Unit.EM);
		
		HTML search = new HTML("<input class=\"adminSearch\" type=\"text\" />");
		header.add(search);
		header.setWidgetLeftRight(search, 13, Unit.EM, 5, Unit.EM);
		
		HTML userline = new HTML("<div class=\"userLine\"><b>Michal</b> | <a href=\"#\">Nastaveni</a> | <a href=\"#\">Odhlasit</a></div>");
		header.add(userline);
		header.setWidgetRightWidth(userline, 0, Unit.EM, 15, Unit.EM);
		
		
		p.addNorth(header, 4);
		//p.addSouth(new HTML("<div class=\"adminFooter\">Spolecny CMS</div>"), 2);
		
		
		/* -- sidebar -- */
		
		VerticalPanel side = new VerticalPanel();
		side.addStyleName("adminSidebar");

		VerticalPanel menu = new VerticalPanel();
		menu.addStyleName("adminMenu");
		menu.add(new HTML("<h3>Modules</h3>"));
		menu.add(new Hyperlink("Pages", "pages"));
		menu.add(new Hyperlink("Layout", "templates"));
		menu.add(new Hyperlink("Tests", "tests"));
				
		DecoratorPanel d = new DecoratorPanel();		
		d.add(menu);
		side.add(d);
		
		
		VerticalPanel widget2 = new VerticalPanel();
		widget2.addStyleName("adminMenu");
		widget2.add(new HTML("<h3>Submenu</h3>"));
		widget2.add(new Hyperlink("Layout.html", "layout.html"));
		widget2.add(new Hyperlink("Homepage.html", "layout.html"));
		widget2.add(new Hyperlink("Site.css", "layout.html"));
		widget2.add(new Button("+ new file"));
				
		DecoratorPanel d2 = new DecoratorPanel();		
		d2.add(widget2);
		side.add(d2);
		
				
		
		
		VerticalPanel widget3 = new VerticalPanel();
		widget3.addStyleName("adminMenu");
		widget3.add(new HTML("<h3>Business Widget</h3>"));
		widget3.add(new HTML("You have <b>$150</b> left."));
				
		DecoratorPanel d3 = new DecoratorPanel();		
		d3.add(widget3);
		side.add(d3);
		
		
		
		p.addWest(side, 14);
		
		
		/* -- content -- */
		
		
		VerticalPanel content = new VerticalPanel();
		content.addStyleName("adminContent");
		content.add(new HTML("helloooo"));
		p.add(content);
		
		
		
		
		p.setHeight("100%");
		
		RootPanel.get().add(p);
		
  }
}
